package com.exp04;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "home",value = "/home")
public class HomeServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        String url1=response.encodeURL("guess");
        String url2 = response.encodeURL("check");
        out.println("<body style=\"text-align:center;font-family:'FiraCode Nerd Font',serif\">A test page show two URL:<br>");
        out.println("<a href=\""+url1+"\">View GuessNumber Servlet<br>");
        out.println("<a href=\""+url1+"\">View CheckUser Servlet");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }
}
